package controller.user.order;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import model.DTO.OrderPaymentDTO;
import service.Impl.OrderServiceImpl;
import service.OrderService;
import util.GetJsonUtil;
import util.ResultUtil;

import java.io.IOException;

@WebServlet("/user/order/payment")
public class OrderPaymentController extends HttpServlet {
    @Override
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        OrderPaymentDTO orderPaymentDTO= (OrderPaymentDTO) GetJsonUtil.get(req,new OrderPaymentDTO());
        OrderServiceImpl orderService = new OrderServiceImpl();
        orderService.payment(orderPaymentDTO);
        String json= ResultUtil.getJSON(null);
        resp.getWriter().write(json);
    }
}
